# !/usr/bin/python
import logging
from django.conf import settings

def get_logger():
    """
    logger = logging.getLogger('app')
    handler = logging.FileHandler(logs_file)
    handler.setLevel(logging.INFO)
    handler.setFormatter(logging.Formatter("%(asctime)s - %(levelname)s - %(filename)s[:%(lineno)d] - %(message)s"))
    logger.addHandler(handler)
    """
    FORMAT = '[%(asctime)s %(filename)s(line:%(lineno)d) %(levelname)s] %(message)s'
    logging.basicConfig(format=FORMAT, filename=settings.LOGS_FILE)
    logger = logging.getLogger('log')
    if settings.LOG_LEVEL == "DEBUG":
        logger.setLevel(logging.DEBUG)
    else:
        logger.setLevel(logging.INFO)
    return logger